#ifndef REGIONSELECTOR_H
#define REGIONSELECTOR_H

#include <vector>
#include <functionalnetwork.h>
#include <correlationmatrix.h>
#include <anatomicalregion.h>
#include <anatomicallink.h>
#include <linkfilter.h>
#include <QObject>
#include <QWidget>
#include <vtkLookupTable.h>

typedef QVector<AnatomicalRegion*> SelectedRegions;
typedef QVector<AnatomicalLink*> SelectedLinks;

class AbstractView : public QWidget
{
    Q_OBJECT

public:
	enum SelectAction
	{
		NewSelection,
		AddToSelection,
		RemoveFromSelection
	};

    AbstractView(QWidget *parent = 0);
	QVector<AnatomicalLink*>& getSelection() const;
    virtual void setSelection(const SelectedLinks& links);
	virtual void setSelection(const SelectedRegions& regions);

	inline AnatomicalRegion *selectedRegion() { return network->selectedRegion(); }
	inline void setSelectedRegion(AnatomicalRegion* reg) { network->setSelectedRegion(reg); }
	
	virtual void setNetwork(FunctionalNetwork *net);
	inline void setRenderMode(FunctionalNetwork::RegionRenderMode m) { network->setRenderMode(m); }
	inline FunctionalNetwork::RegionRenderMode renderMode() { return network->renderMode(); }


public slots:
	inline virtual void on_selectionChanged(const QVector<int> &regions, SelectAction action) {};
	inline virtual void on_selectionChanged(const QVector<QPoint> &links, SelectAction action) {};
	inline virtual void on_colormapChanged() { updateView(); }
	inline virtual void on_selectionChanged() { updateView(); }
	inline virtual void on_matrixChanged() { updateView(); }

protected:
	inline virtual void updateView() { };
    bool isSelected(AnatomicalRegion *reg);
    bool isSelected(AnatomicalLink *link);

	FunctionalNetwork *network;
	AnatomicalTemplate *aTemplate;
};

#endif // REGIONSELECTOR_H
